<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <div>
      用户名： 
      <input type="text" v-model="username" />
    </div>
    <div>
      方向：
      <input value="left" type="radio" id="left" v-model="direction" />
      <label for="left">左边</label>
      <input value="right" type="radio" id="right" v-model="direction" />
      <label for="right">右边</label>
    </div>
    <div>
      爱好:
      <input value="sing" type="checkbox" id="sing" v-model="hobby" />
      <label for="sing">唱跳</label>
      <input value="rap" type="checkbox" id="rap" v-model="hobby" />
      <label for="rap">rap</label>
      <input value="ball" type="checkbox" id="ball" v-model="hobby" />
      <label for="ball">篮球</label>
    </div>
    <div>
      工作：
      <select v-model="job">
        <option value="web">前端</option>
        <option value="java">后段</option>
        <option value="ui">ui</option>
      </select>
    </div>
    <div>
      工作2：
      <select v-model="job2" multiple>
        <option value="web">前端</option>
        <option value="java">后段</option>
        <option value="ui">ui</option>
      </select>
    </div>
    <div>
      内容:
      <textarea v-model="content" cols="30" rows="10"></textarea>
    </div>

    <div>
      <input type="submit" value="提交" @click.prevent="submitFn" />
    </div>
  </div>
  <script src="./vue.js"></script>
  <script>
    new Vue({
      el: '#app',
      data: {
        username: '',
        direction: 'left',
        hobby: ['rap', 'ball'],
        job: 'ui',
        job2: ['web', 'ui'],
        content: ''
      },
      methods: {
        submitFn() {
          // console.log( this.username )
          // console.log( typeof this.hobby)   判断基本数据类型
          // console.log( this.hobby instanceof Array)   判断是是数组
          // console.log( Array.isArray(this.hobby) )  判断是否是数组

          // console.log( this.hobby.toString().split(',') )
          console.log( this.content )
        }
      }
    })
  </script>
</body>
</html>